package org.web.generate.example.ui.config;

import com.jfinal.config.*;
import org.beetl.ext.jfinal.BeetlRenderFactory;
import org.web.generate.example.ui.controller.form.FormController;

/**
 * Created by rsp on 14-11-21.
 */
public class BaseJFinalConfig extends JFinalConfig {

    @Override
    public void configConstant(Constants me) {
        me.setDevMode(true);
        me.setMainRenderFactory(new BeetlRenderFactory());

       // PropertyConfig.me().loadPropertyFile("/init.properties");
    }


    @Override
    public void configInterceptor(Interceptors me) {

    }

    @Override
    public void configHandler(Handlers me) {

    }



    @Override
    public void configPlugin(Plugins me) {
//        PropertyConfig config = PropertyConfig.me();
//        C3p0Plugin cp = new C3p0Plugin(config.getProperty("jdbc.url"),
//                config.getProperty("jdbc.username"),
//                config.getProperty("jdbc.password"),
//                config.getProperty("jdbc.driverClassName")); // 关键：使用C3P0
//        me.add(cp);
//
//        me.add(new EhCachePlugin());
//
//        ActiveRecordPlugin arp = new ActiveRecordPlugin(cp);
//        me.add(arp);
//        arp.setDialect(new AnsiSqlDialect());// 关键：使用AnsiSqlDialect
//        arp.setContainerFactory(new CaseInsensitiveContainerFactory());
//        arp.setShowSql(true);
    }


    @Override
    public void configRoute(Routes me) {
        me.add("/form", FormController.class);
    }
}
